import {
	defineStore
} from 'pinia';
import {
	ref
} from 'vue';
export const useSystemStore = defineStore(
	'system',
	() => {
		const channelId = ref(1)
		const setData = (val = '', key = 'token') => {
			switch (key) {
				default:
					channelId.value = val
					break;
			}
		}
		return {
			system,
			channel,
			channelId,
			setData
		}
	},
	//pinia持久化，必须在使用持久化插件后才能设置
	{
		// persist: true 是用来给网页端持久化的
		persist: {
			storage: {
				getItem(key) {
					return uni.getStorageSync(key)
				},
				setItem(key, value) {
					return uni.setStorageSync(key, value)
				}
			}
		}
	}
)